home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / ANSI Headers / yxvals.h < prev   
Encoding:
Text File  |  1994-10-20  |  1.9 KB  |  79 lines  |  [TEXT/MMCC]

  1. // yxvals.h values header for C++
  2. #ifndef _YXVALS_
  3. #define _YXVALS_
  4. #ifndef _YVALS
  5.  #include <yvals.h>
  6. #endif
  7.  
  8. #if __MWERKS__
  9. #pragma options align=mac68k
  10. #endif
  11.  
  12.   // typeinfo description type
  13. typedef int _Typedesc;
  14.   // type bool
  15. #if _HAS_BOOL_TYPE
  16.  typedef bool _Bool;
  17. #else
  18.  typedef int _Bool;
  19. #endif /* _HAS_BOOL_TYPE */
  20.   // exception macros
  21. #if _HAS_EXCEPTIONS
  22.  #define _TRY_BEGIN try {
  23.  #define _CATCH_ALL } catch (...) {
  24.  #define _CATCH_END }
  25.  #define _RAISE(x) throw (x)
  26.  #define _RERAISE throw
  27. #elif _MICROSOFT_EXCEPTIONS
  28.  #define _TRY_BEGIN TRY
  29.  #define _CATCH_ALL CATCH(CException, _PCEx)
  30.  #define _CATCH_END END_CATCH
  31.  #define _RAISE(x) THROW(&(x))
  32.  #define _RERAISE THROW_LAST()
  33. #else /* no exceptions */
  34.  #define _TRY_BEGIN {{
  35.  #define _CATCH_ALL } if (0) {
  36.  #define _CATCH_END }}
  37.  #define _RAISE(x) xmsg::_Throw(&(x))
  38.  #define _RERAISE xmsg::_Throw(0)
  39. #endif
  40.   // bitmask macros
  41. #if _HAS_ENUM_OVERLOADING
  42.  #define _BITMASK(E, T) typedef E T
  43.  #define _BITMASK_OPS(T) \
  44. inline T& operator&=(T& _X, T _Y) \
  45.  {_X = (T)((int)_X & (int)_Y); return (_X); } \
  46. inline T& operator|=(T& _X, T _Y) \
  47.  {_X = (T)((int)_X | (int)_Y); return (_X); } \
  48. inline T& operator^=(T& _X, T _Y) \
  49.  {_X = (T)((int)_X ^ (int)_Y); return (_X); } \
  50. inline T operator&(T _X, T _Y) \
  51.  {return ((T)((int)_X & (int)_Y)); } \
  52. inline T operator|(T _X, T _Y) \
  53.  {return ((T)((int)_X | (int)_Y)); } \
  54. inline T operator^(T _X, T _Y) \
  55.  {return ((T)((int)_X ^ (int)_Y)); } \
  56. inline T operator~(T _X) \
  57.  {return ((T)~(int)_X); }
  58. #else
  59.  #define _BITMASK(E, T) typedef int T
  60.  #define _BITMASK_OPS(T)
  61. #endif /* _HAS_ENUM_OVERLOADING */
  62. #define _HAS_PJP_CLIB 1 /* for filebuf/FILE coordination */
  63.  
  64. #if __MWERKS__
  65. #pragma options align=reset
  66. #endif
  67.  
  68. #endif /* _YXVALS_ */
  69.  
  70. /*
  71.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  72.  * Consult your license regarding permissions and restrictions.
  73.  */
  74.  
  75. /* Change log:
  76.  *94Oct03 Version received from PlumHall
  77.  *94Oct08 Inserted MW changes.
  78.  */
  79.